class CatalogItem {
    constructor(id, title, tags) {
        this._id = id;
        this._title = title;
        this._tags = tags;
    }

    get id() {
        return this._id;
    }

    get title() {
        return this._title;
    }

    get tags() {
        return this._tags;
    }

    hasTags(arg) {
        return this._tags.includes(arg);
    }
}

class Scroll extends CatalogItem {
    constructor(id, title, tags, dateLastCleaned) {
        super(id, title, tags);
        this._lastCleaned = dateLastCleaned;
    }

    needsCleaning(targetDate) {
        const threshold = this.hasTags("revered") ? 700 : 1500;
        return this.daysSinceLastCleaning(targetDate) > threshold;
    }

    daysSinceLastCleaning(targetDate) {
        return this._lastCleaned.until(targetDate, ChronoUnit.DAYS);
    }
}
/****************************************************************************************** */
// 真实存在的卷轴和只存在纸面上的目录是完全不同的两种东西，因此这是一个糟糕的模型。
class Scroll {
    constructor(id, dateLastCleaned, catalogID, catalog) {
        this._id = id;
        this._catalogItem = catalog.get(catalogID);
        this._lastCleaned = dateLastCleaned;
    }

    needsCleaning(targetDate) {
        const threshold = this.hasTags("revered") ? 700 : 1500;
        return this.daysSinceLastCleaning(targetDate) > threshold;
    }

    daysSinceLastCleaning(targetDate) {
        return this._lastCleaned.until(targetDate, ChronoUnit.DAYS);
    }

    get id() {
        return this._id;
    }

    get title() {
        return this._catalogItem._title;
    }

    hasTags(arg) {
        return this._catalogItem._tags.includes(arg);
    }
}

const scrolls = aDocument.map(record => new Scroll(record.id, LocalDate.parse(record.lastCleaned), record.catalogData.id, catalog));